package proxy2;

/**
 * @author 宋鑫宇
 * @version 1.0
 */
public class UserServiceImpl implements UserService {
    @Override
    public String login(String name, String pwd) {

        String rs = "用户名或密码错误";
        if ("admin".equals(name) && "123456".equals(pwd)) {
            rs = "登陆成功";
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        return rs;
    }

    @Override
    public void deleteUsers() {
//        long starTime = System.currentTimeMillis();
        System.out.println("正在删除数据...");
        try {
            Thread.sleep(3000);
        } catch (Exception e) {
            e.printStackTrace();
        }
//        long endTime = System.currentTimeMillis();
//        System.out.println("deleteUsers方法耗时" + (starTime - endTime) / 1000.00 + "秒");
    }

    @Override
    public String selectUsers() {
//        long starTime = System.currentTimeMillis();
        String rs = "查询数据完成";
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//        long endTime = System.currentTimeMillis();
//        System.out.println("selectUsers方法耗时" + (starTime - endTime) / 1000.00 + "秒");
        return rs;

    }
}
